
package webservice.xfire.util;

import org.codehaus.xfire.XFire;
import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.server.http.XFireHttpServer;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import org.codehaus.xfire.service.invoker.BeanInvoker;

import upload.IUploadService;
import upload.UploadService;


public class Service {

	public boolean start() {
		ObjectServiceFactory serviceFactory = new ObjectServiceFactory();
		org.codehaus.xfire.service.Service service = serviceFactory.create(IUploadService.class);
		service.setInvoker(new BeanInvoker(new UploadService()));

		XFire xfire = XFireFactory.newInstance().getXFire();
		xfire.getServiceRegistry().register(service);

		XFireHttpServer httpServer = new XFireHttpServer();
		httpServer.setPort(8191);
		try {
			httpServer.start();
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	public static void main(String[] args) {
		Service service = new Service();
		service.start();
	}

}
